#include "mainwindow.h"
#include "widgets/quiwidget.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    // Settings
    QCoreApplication::setOrganizationName("None");
    QCoreApplication::setOrganizationDomain("None");
    QCoreApplication::setApplicationName("AD-Analyzer");

    QApplication a(argc, argv);
    //设置分辨率与字体
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    a.setFont(QFont("Microsoft Yahei", 9));
    a.setWindowIcon(QIcon(":/main.ico"));

    //设置主窗体
    QUIWidget qui;
    MainWindow *mainWindow = new MainWindow;
    qui.setMainWidget(mainWindow);

    //设置标题
    qui.setTitle(QString("AD Analyzer V%1").arg(QString::number(VT_VERSION, 'f', 2)));
    QFont font = qui.font();
    font.setPointSize(15);
    qui.setFont(font);

    //设置标题文本居中
    qui.setAlignment(Qt::AlignCenter);

    //设置标题栏高度
    qui.setTitleHeight(50);

    //设置按钮宽度
    qui.setBtnWidth(50);

    //设置左上角图标-图形字体
    qui.setIconMain(QChar(0xf285), 11);

    //加载qss文件
    QFile file(":/res/qss/lightblue.css");
    if (file.open(QFile::ReadOnly))
    {
        QString qss = QLatin1String(file.readAll());
        QString paletteColor = qss.mid(20, 7);
        a.setPalette(QPalette(QColor(paletteColor)));
        a.setStyleSheet(qss);
        file.close();
    }

    qui.showMaximized();
    return a.exec();
}
